// Borland C++ Builder
// Copyright (c) 1995, 1999 by Borland International
// All rights reserved

// (DO NOT EDIT: machine generated header) 'calc.pas' rev: 5.00

#ifndef calcHPP
#define calcHPP

#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <Classes.hpp>	// Pascal unit
#include <SysUtils.hpp>	// Pascal unit
#include <SysInit.hpp>	// Pascal unit
#include <System.hpp>	// Pascal unit

//-- user supplied -----------------------------------------------------------

namespace Calc
{
//-- type declarations -------------------------------------------------------
#pragma option push -b-
enum TToken { tkEOF, tkERROR, tkASSIGN, tkLBRACE, tkRBRACE, tkNUMBER, tkIDENT, tkSEMICOLON, tkPOW, tkINV, 
	tkNOT, tkMUL, tkDIV, tkMOD, tkPER, tkADD, tkSUB, tkLT, tkLE, tkEQ, tkNE, tkGE, tkGT, tkOR, tkXOR, tkAND 
	};
#pragma option pop

class DELPHICLASS ECalculate;
class PASCALIMPLEMENTATION ECalculate : public Sysutils::Exception 
{
	typedef Sysutils::Exception inherited;
	
public:
	#pragma option push -w-inl
	/* Exception.Create */ inline __fastcall ECalculate(const AnsiString Msg) : Sysutils::Exception(Msg
		) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateFmt */ inline __fastcall ECalculate(const AnsiString Msg, const System::TVarRec 
		* Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateRes */ inline __fastcall ECalculate(int Ident)/* overload */ : Sysutils::Exception(
		Ident) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResFmt */ inline __fastcall ECalculate(int Ident, const System::TVarRec * Args, 
		const int Args_Size)/* overload */ : Sysutils::Exception(Ident, Args, Args_Size) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateHelp */ inline __fastcall ECalculate(const AnsiString Msg, int AHelpContext) : Sysutils::Exception(
		Msg, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateFmtHelp */ inline __fastcall ECalculate(const AnsiString Msg, const System::TVarRec 
		* Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext
		) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResHelp */ inline __fastcall ECalculate(int Ident, int AHelpContext)/* overload */
		 : Sysutils::Exception(Ident, AHelpContext) { }
	#pragma option pop
	#pragma option push -w-inl
	/* Exception.CreateResFmtHelp */ inline __fastcall ECalculate(System::PResStringRec ResStringRec, const 
		System::TVarRec * Args, const int Args_Size, int AHelpContext)/* overload */ : Sysutils::Exception(
		ResStringRec, Args, Args_Size, AHelpContext) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* TObject.Destroy */ inline __fastcall virtual ~ECalculate(void) { }
	#pragma option pop
	
};


#pragma option push -b-
enum TCalcCBType { ctGetValue, ctSetValue, ctFunction };
#pragma option pop

typedef bool __fastcall (*TCalcCBProc)(TCalcCBType ctype, const AnsiString S, double &Value);

struct TNamedVar;
typedef TNamedVar *PNamedVar;

struct TNamedVar
{
	double Value;
	char Name[1];
} ;

class DELPHICLASS CCalculator;
class PASCALIMPLEMENTATION CCalculator : public Classes::TComponent 
{
	typedef Classes::TComponent inherited;
	
private:
	AnsiString FExpression;
	Classes::TList* FVars;
	double __fastcall GetResult(void);
	double __fastcall GetVar(const AnsiString Name);
	void __fastcall SetVar(const AnsiString Name, double value);
	
protected:
	virtual bool __fastcall Callback(TCalcCBType ctype, const AnsiString Name, double &Res);
	
public:
	__fastcall virtual CCalculator(Classes::TComponent* AOwner);
	__fastcall virtual ~CCalculator(void);
	AnsiString __fastcall NameOf(Word Index);
	void __fastcall ClearVars(void);
	__property double Result = {read=GetResult};
	__property double Vars[AnsiString Name] = {read=GetVar, write=SetVar};
	
__published:
	__property AnsiString Expression = {read=FExpression, write=FExpression};
};


//-- var, const, procedure ---------------------------------------------------
extern PACKAGE System::ResourceString _SSyntaxError;
#define Calc_SSyntaxError System::LoadResourceString(&Calc::_SSyntaxError)
extern PACKAGE System::ResourceString _SFunctionError;
#define Calc_SFunctionError System::LoadResourceString(&Calc::_SFunctionError)
extern PACKAGE System::ResourceString _SInvalidDegree;
#define Calc_SInvalidDegree System::LoadResourceString(&Calc::_SInvalidDegree)
extern PACKAGE void __fastcall Register(void);

}	/* namespace Calc */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Calc;
#endif
#pragma option pop	// -w-
#pragma option pop	// -Vx

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif	// calc
